﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using CoreModel = PlayerScannerCore.Model;
using Mvvm;
using PlayerScannerCore.Model;

namespace PlayerScannerCore.ViewModel
{
    public class WeaponViewModel : ItemViewModel, IWeapon
    {
        private int _nativeBonus;
        private int _aBeastBonus;
        private int _machineBonus;
        private int _darkBonus;
        private int _hitBonus;
        private int _grind;
        private int _maxGrind;
        private int _kills;
        private string _special;
        private bool _isUntek;
        private bool _isBasic;
        private int _equippableBy;
        private int _minBaseAtpBoost;
        private int _maxBaseAtpBoost;
        private int _atpReq;
        private int _mstReq;
        private int _ataReq;
        private int _mstBoost;
        private int _ataBoost;

        internal WeaponViewModel()
        {
            ItemType = ItemType.Weapon;
        }

        internal override void Update(IItem item)
        {
            var weapon = (IWeapon)item;

            NativeBonus = weapon.NativeBonus;
            ABeastBonus = weapon.ABeastBonus;
            MachineBonus = weapon.MachineBonus;
            DarkBonus = weapon.DarkBonus;
            HitBonus = weapon.HitBonus;
            Grind = weapon.Grind;
            MaxGrind = weapon.MaxGrind;
            Kills = weapon.Kills;
            Special = weapon.Special;
            IsUntekked = weapon.IsUntekked;
            IsBasic = weapon.IsBasic;
            EquippableBy = weapon.EquippableBy;
            MinAtpBoost = weapon.MinAtpBoost;
            MaxAtpBoost = weapon.MaxAtpBoost;
            AtpRequired = weapon.AtpRequired;
            MstRequired = weapon.MstRequired;
            AtaRequired = weapon.AtaRequired;
            MstBoost = weapon.MstBoost;
            AtaBoost = weapon.AtaBoost;

            base.Update(weapon);
        }

        public int EquippableBy
        {
            get { return _equippableBy; }
            set
            {
                if (_equippableBy != value)
                {
                    _equippableBy = value;
                    OnPropertyChanged("EquippableBy");
                }
            }
        }

        public int MinAtpBoost
        {
            get { return _minBaseAtpBoost; }
            set
            {
                if (_minBaseAtpBoost != value)
                {
                    _minBaseAtpBoost = value;
                    OnPropertyChanged("MinAtpBoost");
                }
            }
        }

        public int MaxAtpBoost
        {
            get { return _maxBaseAtpBoost; }
            set
            {
                if (_maxBaseAtpBoost != value)
                {
                    _maxBaseAtpBoost = value;
                    OnPropertyChanged("MaxAtpBoost");
                }
            }
        }

        public int AtpRequired
        {
            get { return _atpReq; }
            set
            {
                if (_atpReq != value)
                {
                    _atpReq = value;
                    OnPropertyChanged("AtpRequired");
                }
            }
        }

        public int MstRequired
        {
            get { return _mstReq; }
            set
            {
                if (_mstReq != value)
                {
                    _mstReq = value;
                    OnPropertyChanged("MstRequired");
                }
            }
        }

        public int AtaRequired
        {
            get { return _ataReq; }
            set
            {
                if (_ataReq != value)
                {
                    _ataReq = value;
                    OnPropertyChanged("AtaRequired");
                }
            }
        }

        public int MstBoost
        {
            get { return _mstBoost; }
            set
            {
                if (_mstBoost != value)
                {
                    _mstBoost = value;
                    OnPropertyChanged("MstBoost");
                }
            }
        }

        public int AtaBoost
        {
            get { return _ataBoost; }
            set
            {
                if (_ataBoost != value)
                {
                    _ataBoost = value;
                    OnPropertyChanged("AtaBoost");
                }
            }
        }

        public int NativeBonus
        {
            get { return _nativeBonus; }
            set
            {
                if (_nativeBonus != value)
                {
                    _nativeBonus = value;
                    OnPropertyChanged("NativeBonus");
                }
            }
        }

        public int ABeastBonus
        {
            get { return _aBeastBonus; }
            set
            {
                if (_aBeastBonus != value)
                {
                    _aBeastBonus = value;
                    OnPropertyChanged("ABeastBonus");
                }
            }
        }

        public int MachineBonus
        {
            get { return _machineBonus; }
            set
            {
                if (_machineBonus != value)
                {
                    _machineBonus = value;
                    OnPropertyChanged("MachineBonus");
                }
            }
        }

        public int DarkBonus
        {
            get { return _darkBonus; }
            set
            {
                if (_darkBonus != value)
                {
                    _darkBonus = value;
                    OnPropertyChanged("DarkBonus");
                }
            }
        }

        public int HitBonus
        {
            get { return _hitBonus; }
            set
            {
                if (_hitBonus != value)
                {
                    _hitBonus = value;
                    OnPropertyChanged("HitBonus");
                }
            }
        }

        public int Grind
        {
            get { return _grind; }
            set
            {
                if (_grind != value)
                {
                    _grind = value;
                    OnPropertyChanged("Grind");
                }
            }
        }

        public int MaxGrind
        {
            get { return _maxGrind; }
            set
            {
                if (_maxGrind != value)
                {
                    _maxGrind = value;
                    OnPropertyChanged("MaxGrind");
                }
            }
        }

        public int Kills
        {
            get { return _kills; }
            set
            {
                if (_kills != value)
                {
                    _kills = value;
                    OnPropertyChanged("Kills");
                }
            }
        }

        public string Special
        {
            get { return _special; }
            set
            {
                if (_special != value)
                {
                    _special = value;
                    OnPropertyChanged("Special");
                }
            }
        }

        public bool IsUntekked
        {
            get { return _isUntek; }
            set
            {
                if (_isUntek != value)
                {
                    _isUntek = value;
                    OnPropertyChanged("IsUntek");
                }
            }
        }

        public bool IsBasic
        {
            get { return _isBasic; }
            set
            {
                if (_isBasic != value)
                {
                    _isBasic = value;
                    OnPropertyChanged("IsBasic");
                }
            }
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 23;
                hash = hash * 29 + NativeBonus.GetHashCode();
                hash = hash * 29 + ABeastBonus.GetHashCode();
                hash = hash * 29 + MachineBonus.GetHashCode();
                hash = hash * 29 + DarkBonus.GetHashCode();
                hash = hash * 29 + HitBonus.GetHashCode();
                hash = hash * 29 + Grind.GetHashCode();
                hash = hash * 29 + MaxGrind.GetHashCode();
                hash = hash * 29 + Kills.GetHashCode();
                hash = hash * 29 + Special.GetHashCode();
                hash = hash * 29 + IsUntekked.GetHashCode();
                hash = hash * 29 + IsBasic.GetHashCode();
                hash = hash * 29 + EquippableBy.GetHashCode();
                hash = hash * 29 + MinAtpBoost.GetHashCode();
                hash = hash * 29 + MaxAtpBoost.GetHashCode();
                hash = hash * 29 + AtpRequired.GetHashCode();
                hash = hash * 29 + MstRequired.GetHashCode();
                hash = hash * 29 + AtaRequired.GetHashCode();
                hash = hash * 29 + MstBoost.GetHashCode();
                hash = hash * 29 + AtaBoost.GetHashCode();
                return hash * 29 + base.GetHashCode();
            }
        }

        public override bool Equals(object obj)
        {
            var objAsSpecific = obj as WeaponViewModel;

            if (objAsSpecific == null)
                return false;

            if (ReferenceEquals(this, obj))
                return true;

            return objAsSpecific.NativeBonus == NativeBonus
                && objAsSpecific.ABeastBonus == ABeastBonus
                && objAsSpecific.MachineBonus == MachineBonus
                && objAsSpecific.DarkBonus == DarkBonus
                && objAsSpecific.HitBonus == HitBonus
                && objAsSpecific.Grind == Grind
                && objAsSpecific.MaxGrind == MaxGrind
                && objAsSpecific.Kills == Kills
                && objAsSpecific.Special == Special
                && objAsSpecific.IsUntekked == IsUntekked
                && objAsSpecific.IsBasic == IsBasic
                && objAsSpecific.EquippableBy == EquippableBy
                && objAsSpecific.MinAtpBoost == MinAtpBoost
                && objAsSpecific.MaxAtpBoost == MaxAtpBoost
                && objAsSpecific.AtpRequired == AtpRequired
                && objAsSpecific.MstRequired == MstRequired
                && objAsSpecific.AtaRequired == AtaRequired
                && objAsSpecific.MstBoost == MstBoost
                && objAsSpecific.AtaBoost == AtaBoost
                && base.Equals(obj);
        }
    }
}
